﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="PhanQuyen.aspx.cs" Inherits="DemoExtNet.PhanQuyen.PhanQuyen" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%--<%@ Register Src="UserControls/QUNguoiDung.ascx" TagName="QUNguoiDung" TagPrefix="uc1" %>--%>
<%--<%@ Register Src="UserControls/QUNhomQuyenByToChuc_Detail.ascx" TagName="QUNhomQuyenByToChuc_Detail"
    TagPrefix="uc1" %>--%>
<%@ Register Src="UserControls/QUNhomQuyenByToChuc_Edit.ascx" TagName="QUNhomQuyenByToChuc_Edit"
    TagPrefix="uc1" %>
    <%@ Register Src="UserControls/NhomQuyenByToChuc.ascx" TagName="NhomQuyenByToChuc"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript">
        var grdNhomQuyen_Command = function(command, record) {
            if (command == 'Detail') {
                ApplicationName.ShowDialog_QUNhomQuyenByToChuc_Detail(record.id);
                return;
            }

            if (command == 'Edit') {
                ApplicationName.ShowDialog_QUNhomQuyenByToChuc_Edit(record.id, record.data.TenNhomQuyenByToChuc, record.data.GhiChu);
                return;
            }

            if (command == 'Delete') {
                Ext.MessageBox.show({
                   title: 'Confirm',
                   msg: 'Bạn có chắc chắn xóa record này ko?',
                   icon: Ext.MessageBox.QUESTION,
                   buttons: Ext.MessageBox.YESNO,
                   fn: function(btn)
                   {
                    if(btn.toLowerCase()=='yes')
                    {
                        //Do Yes
                        ApplicationName.NhomQuyenByToChuc_Delete(record.id);
                    }
                   }
                });
            }

        }       
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpLeft" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cpMain" runat="server">
    <h2>Nhóm Quyền Theo Tổ Chức</h2>
            <ext:Panel ID="tabNhomQuyen" runat="server"  Layout="Fit" MonitorResize="true" Border="false">
                <Items>
                    <ext:GridPanel ID="grdNhomQuyen" runat="server" Width="500" Height="300" AutoExpandColumn="TenNhomQuyenByToChuc">
                        <TopBar>
                            <ext:Toolbar runat="server">
                                <Items>
                                    <ext:Button ID="btnAddNew" runat="server" Text="Add New" Icon="Add">
                                        <DirectEvents>
                                            <Click OnEvent="ShowDialog_QUNhomQuyenByToChuc_AddNew"></Click>
                                        </DirectEvents>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <ColumnModel>
                            <Columns>
                                <ext:CommandColumn Width="50">
                                    <Commands>
                                        <ext:SplitCommand>
                                            <Menu>
                                                <Items>
                                                    <ext:MenuCommand Text="Chi Tiết" CommandName="Detail">
                                                    </ext:MenuCommand>
                                                    <ext:MenuCommand Text="Chỉnh Sửa" CommandName="Edit">
                                                    </ext:MenuCommand>
                                                    <ext:MenuCommand Text="Xóa" CommandName="Delete">
                                                    </ext:MenuCommand>
                                                </Items>
                                            </Menu>
                                        </ext:SplitCommand>
                                    </Commands>
                                </ext:CommandColumn>
                                <ext:Column DataIndex="TenNhomQuyenByToChuc" Header="Tên Nhóm Quyền (Tổ Chức) ">
                                </ext:Column>
                                <ext:Column DataIndex="GhiChu" Header="Ghi Chú" Width="250">
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <Store>
                            <ext:Store ID="storeQUNhomQuyenByToChuc" runat="server">
                                <Reader>
                                    <ext:JsonReader IDProperty="NhomQuyenByToChucID">
                                        <Fields>
                                            <ext:RecordField Name="TenNhomQuyenByToChuc">
                                            </ext:RecordField>
                                            <ext:RecordField Name="GhiChu">
                                            </ext:RecordField>
                                        </Fields>
                                    </ext:JsonReader>
                                </Reader>
                            </ext:Store>
                        </Store>
                        <Listeners>
                            <Command Handler="grdNhomQuyen_Command(command,record);" />
                        </Listeners>
                    </ext:GridPanel>
                </Items>
            </ext:Panel>
            
    <%--<uc1:QUNguoiDung ID="ucQUNguoiDung" runat="server" />--%>
    <%--<uc1:QUNhomQuyenByToChuc_Detail ID="ucQUNhomQuyenByToChuc_Detail" runat="server" />--%>
    <uc1:QUNhomQuyenByToChuc_Edit ID="ucQUNhomQuyenByToChuc_Edit" runat="server" />
    <uc1:NhomQuyenByToChuc ID="ucNhomQuyenByToChuc" runat="server" />
    
</asp:Content>
